<?php

namespace app\controller\index;

use app\exception\IndexException;
use support\Request;

class IndexController extends BaseController
{
    public function index(Request $request)
    {
        throw new IndexException(4020,'自定义错误');
        static $readme;
        if (!$readme) {
            $readme = file_get_contents(base_path('README.md'));
        }
        return $readme;
    }

    public function view(Request $request)
    {
        return view('index/view', ['name' => 'webman']);
    }

    public function json(Request $request)
    {
        $param = $request->all();
        $header = $request->header();
        return $this->endSuccess([]);
        //return json(['code' => 0, 'msg' => 'ok','param'=>$param,'header'=>$header]);
    }

}
